#pragma once
#include <memory>
#include <string>
#include <SFML/Graphics/Rect.hpp>
#include <SFML/Graphics/Image.hpp>
#include <SFML/Graphics/Texture.hpp>
#include <nice2d/component.h>

class ImageManager final: public Component
{
public:
    ImageManager();
    ~ImageManager();
public:
    void clear();

    std::shared_ptr<sf::Image> loadImageFromFile(const std::string &file);
    std::shared_ptr<sf::Texture> loadTextureFromFile(const std::string& file,const sf::IntRect& area = {0,0,0,0});

    PTree serialize() override;
    void deserialize(const PTree &node) override;
private:
    std::unique_ptr<class ImageManagerData> data;
};


